#include <iostream>
#include <map>
#include <vector>

typedef std::map<std::string, int> InodeMap;
typedef InodeMap::iterator InodeMapIter;
typedef InodeMap::value_type InodeMapVal;


#define HASH_SIZE  5
std::vector<InodeMap *> inodeList;

void getSize()
{
	unsigned size = 0;
	for (unsigned i = 0; i < HASH_SIZE; i++)
	{
		std::cout << "inodelist i=" << i << " size=" << inodeList[i]->size() << std::endl;
		size += inodeList[i]->size();	
	}
	std::cout << "==========inodelist TotalSize=" << size << std::endl;
}

int main(int argc, char *argv[])
{
	inodeList.resize(HASH_SIZE);

	for(int i = 0; i < HASH_SIZE; i++)
	{
		inodeList[i] = new InodeMap();
	}
	getSize();


	int key = 3;
	inodeList[key]->insert({"c", 3});
	inodeList[key]->insert({"d", 3});
	inodeList[key]->insert({"e", 3});

	if (inodeList[key]->size() > 0)
	{
		for (auto it = inodeList[key]->begin(); it != inodeList[key]->end(); it++)
		{
			std::cout << it->first << ":" << it->second << std::endl;	
		}
	}
	getSize();


	inodeList[key]->erase("c");
	inodeList[key]->erase("d");
	if (inodeList[key]->size() > 0)
	{
		for (auto it = inodeList[key]->begin(); it != inodeList[key]->end(); it++)
		{
			std::cout << it->first << ":" << it->second << std::endl;	
		}
	}
	getSize();


	inodeList[key]->erase("e");
	getSize();

	return 0;
}


/*
   std::pair<TestMapIter, bool> res = test.insert(TestMapVal("b", 2));
   for (auto it = test.begin(); it != test.end(); )
   {
   std::cout << it->first << ":" << it->second<< std::endl;	
   if (it->second != 6) {
   std::cout << "erase > " << it->first << ":" << it->second<< std::endl;	
   it = test.erase(it);
   }
   }
   */
